﻿using SqlSugar;

var db = new SqlSugarClient(new ConnectionConfig()
{
    ConnectionString = "server=localhost;Database=apidata;Uid=root;Pwd=123456;",
    DbType = DbType.MySql,
    IsAutoCloseConnection = true,
    InitKeyType = InitKeyType.Attribute
});

#region 对话框
Console.WriteLine("是否确定生成实体？");
var str = Console.ReadKey();
if (str.Key == ConsoleKey.Enter)
{
    Console.WriteLine("同步中，请稍后...");
    db.DbFirst.IsCreateAttribute().CreateClassFile(@"D:\Desktop");
}
else
{
    Console.WriteLine("\r\n输入错误，已退出...");
    return;
}
Console.WriteLine("数据库结构同步完成!");
#endregion